/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package calculation;

import java.io.Serializable;

/**
 *
 * @author jzajaczek
 */
public class RectangleAreaBean extends AreaBean implements Serializable {
    private double a = 100.0;
    private double b = 60.0;
    private double area;
    
    ToolUnitBean tu = new ToolUnitBean();
    
    public String check() {
        if (this.a < 0.0) {
            return "failure";
        }
        else if (this.b < 0.0) {
            return "failure";
        }
        else {
            return "success";
        }
    }
    
    public RectangleAreaBean() {}

    /**
     * @return the a
     */
    public double getA() {
        return a;
    }

    /**
     * @param a the a to set
     */
    public void setA(double id) {
        this.a = id;
    }

    /**
     * @return the b
     */
    public double getB() {
        return b;
    }

    /**
     * @param b the b to set
     */
    public void setB(double od) {
        this.b = od;
    }

    /**
     * @return the area
     */
    @Override
    public double getArea() {
        return tu.round(a * b, 2);
    }

    /**
     * @param area the area to set
     */
    @Override
    public void setArea(double area) {
        this.area = area;
    }
}